﻿@inherits BaseComponent

@namespace FluentCMS.Web.Plugins.Admin.ContentTypeManagement
@if (Model != null)
{
    <EditForm Model="@Model" OnSubmit="OnFormSubmit">
        <DataAnnotationsValidator />
        <Modal Placement="ModalPlacement.Top" Size="ModalSize.Large">
            <ModalHeader Closable OnClose="OnCancel">
                <ModalTitle Visible="@(CurrentState == FieldManagementState.Create)">
                    Create New Field@* New @FieldType?.Title Field *@
                </ModalTitle>
                <ModalTitle Visible="@(CurrentState == FieldManagementState.Edit)">
                    Update Field@* Update Field @Model.Name (@FieldType?.Title) *@
                </ModalTitle>
            </ModalHeader>
            <ModalBody>
                @ChildContent
                <Alert Visible="Errors.Count > 0" Type="AlertType.Danger">
                    @foreach (var error in Errors)
                    {
                        <p>@error</p>
                    }
                </Alert>
            </ModalBody>
            <ModalFooter>
                <FormActions>
                    <Button Color="Color.Primary" Type="ButtonType.Submit">
                        Submit
                    </Button>
                    <Button @onclick="OnCancel">
                        Cancel
                    </Button>
                </FormActions>
            </ModalFooter>
        </Modal>
    </EditForm>
}
